package com.youngjun.common.pojo.vo.support;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.dozer.DozerBeanMapperBuilder;
import org.dozer.Mapper;


public class BaseVO<VO> {

    /**
     * DO to VO
     *
     * @return
     */
    @JsonIgnore
    public Mapper getVOMapper() {
        return DozerBeanMapperBuilder.create().build();
    }

    public VO mapFrom(Object src, Mapper mapper) {
        if (src != null){
            mapper.map(src, this);
        }
        return (VO) this;
    }

    public VO mapFrom(Object src) {
        return mapFrom(src, getVOMapper());
    }
}
